﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class ChartLayout : MonoBehaviour
{
    private int widthl = 100;

    private int heightt = 30;

    public int charts = 3;

    void Start()
    {
        int w = Screen.width;
        int h = Screen.height;

        // if (w > h)
        // {
        //     inithview(w - widthl, h - heightt);
        //     return;
        // }
        initvview(w - widthl, h - heightt);
    }

    void initvview(int w, int h)
    {

        GridLayoutGroup glg = GetComponent<GridLayoutGroup>();
        glg.cellSize = new Vector2(w - 8, h / charts - 8);
    }

    void inithview(int w, int h)
    {

        GridLayoutGroup glg = GetComponent<GridLayoutGroup>();
        glg.cellSize = new Vector2(w / 2 - 8, h / 2 - 8);
    }

    // Update is called once per frame
    void Update()
    {
    }
}
